/**
* \file DGVMain.h
*
* \brief This file defines the class for the Main Window using only Qt.
* \author Shekhar S. Chandra, 2008
*
* This file is part of DGV Library.
*
* DGV is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DGV is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DGV.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DGVMAIN_H_INCLUDED
#define DGVMAIN_H_INCLUDED

#include <QtGui/QMainWindow> //For base class
#include <QtCore/QSignalMapper>

#include "DGVImage.h"

/*!
    \class DGVMain
    \brief This class represents the DGV Main Window object.

    The class represents the DGV Main Window object using the Qt Library. It contains a Workspace environment for the user and subsequent operations critical for the User Interface (UI) of the Discrete Geometry Viewer (DGV) program.
*/
class DGV_EXPORT DGVMain : public QMainWindow
{
    Q_OBJECT

public:
    /*!
        \fn DGVMain::DGVMain(QWidget *parent = 0)
        \brief The standard constructor
    */
    DGVMain(QWidget *parent = 0);
    /*!
        \fn DGVMain::~DGVMain()
        \brief The standard destructor
    */
    ~DGVMain();

    /**
        \fn DGVMain::addWindowToWorkspace(QWidget *win)
        \brief Adds widget into workspace.
    */
    inline void addWindowToWorkspace(QWidget *win)
    {   workspace->addWindow(win);  }
    /**
        \fn DGVMain::addImage(DGVImage *img)
        \brief Adds an image widget and links its results and tables.
    */
    void addImage(DGVImage *img);
    /**
        \fn DGVMain::addTable(DGVTable *tbl)
        \brief Adds a table widget and links its results and tables.
    */
    void addTable(DGVTable *tbl);
    /**
        \fn DGVMain::addPlot(DGVPlot *plot)
        \brief Adds a plot widget and links its results and tables.
    */
    void addPlot(DGVPlot *plot);

protected slots:
    /*!
        \fn DGVMain::displayImage(DGVImage *img)
        \brief Handles the displaying of result as they are produced.
    */
    void displayImage(DGVImage *img);
    /*!
        \fn DGVMain::displayTable(DGVTable *newTable)
        \brief Handles the displaying of tables as they are produced.
    */
    void displayTable(DGVTable *newTable);
    /*!
        \fn DGVMain::displayPlot(DGVPlot *newPlot)
        \brief Handles the displaying of plots as they are produced.
    */
    void displayPlot(DGVPlot *newPlot);

    /**
        \fn DGVMain::open()
        \brief Opens image or other files for analysis and display.
    */
    void open();
    /**
        \fn DGVMain::save()
        \brief Opens image or other files for analysis and display.
    */
    void save();
    /**
        \fn DGVMain::newTable()
        \brief Creates table for analysis and display.
    */
    void newTable();
    /**
        \fn DGVMain::newImage()
        \brief Creates image for analysis and display.
    */
    void newImage();

    void cut();
    void copy();
    void paste();

protected:
    QWorkspace *workspace; //!< Pointer to the Workspace environment for the user.
    QSignalMapper *windowMapper; //!< Used to keep events in workspace in order.

    ///Actions
    //----File----
    QAction *actionOpen;
    QAction *actionSave;
    QAction *actionExit;
    //----New----
    QAction *actionNewTable;
    QAction *actionNewImage;
    //----Windows----
    QAction *actionCascade;
    QAction *actionTile;

    ///Menus
    QMenuBar *menuBar;
    QMenu *menuFile;
    QMenu *menuNew;
    QMenu *menuWindows;

    void createMenu();
    void createConnections();

};

#endif // DGVMAIN_H_INCLUDED
